/**
* @author Ashish Gupta
* CVSSP, University of Surrey
* Copyright (c) 2010 Ashish Gupta
* All rights reserved.
*/
/**
 * 
 */
package uk.surrey.ash.ga;

import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;

/**
 * @author Ashish
 *
 */
@SuppressWarnings("unused")
public class GALab {

	/**
	 * @param args
	 * args0 : dataset
	 * args1 : hashcodes
	 */
	public static void main(String[] args) {
//		Instantiate classes
		Population pop = new Population();
		CellSpace cellspace = new CellSpace();
		Dataset carvoc06 = new Dataset();
		HashCode hashcodes = new HashCode();
//		Initialise classes
		try {
			carvoc06.setImages(args[0]);
		} catch (IOException e) {
			System.out.println("File not Found");
			e.printStackTrace();
			System.exit(1);
		}
		try {
			hashcodes.setHashcode(args[1]);
		} catch (IOException e) {
			System.out.println("File not Found");
			e.printStackTrace();
			System.exit(1);
		}

//		create population
		cellspace.setCells(carvoc06,hashcodes);
		pop.setPopulation(cellspace);
		for(int i=0;i<pop.getPopulation().size();i++){
			pop.getPopulation().get(i).printChromosomeCodebook();
			pop.getPopulation().get(i).printChromosomeFitness();
		}

//		mutate population
		for(int numGenerations = 1; numGenerations < 100; numGenerations++){
			pop.mutatePopulation();
//			pop.getPopulation().get(0).printChromosomeCodebook();
			pop.getPopulation().get(0).printChromosomeFitness();
//			for(int i=0;i<pop.getPopulation().size();i++){
//				pop.getPopulation().get(i).printChromosomeCodebook();
//				pop.getPopulation().get(i).printChromosomeFitness();
//			}
		}

	}

}
